<?php
declare (strict_types=1);

namespace app\admin\controller;

use app\BaseController;
use app\model\Coupon;
use app\model\Order;
use app\model\Users;

class Index extends BaseController
{
    /**
     * 后台面板
     * @return \think\response\Json
     */
    public function index()
    {


        $user=Users::count();
        $order=Order::count();
        $p_order=Order::where('status','>',10)->count();
        $coupon=Coupon::count();
        $data = [
            [
                "title" => "支付訂單",
                "value" => $p_order,
                "unit" => "年",
                "unitColor" => "success",
                "subTitle" => "總支付訂單",
                "subValue" => 49,
                "subUnit" => ""

            ],
            [
                "title" => "總訂單",
                "value" => $order,
                "unit" => "年",
                "unitColor" => "success",
                "subTitle" => "總訂單",
                "subValue" => 49,
                "subUnit" => ""

            ],
            [
                "title" => "新增用戶",
                "value" => $user,
                "unit" => "年",
                "unitColor" => "success",
                "subTitle" => "新增用戶",
                "subValue" => 49,
                "subUnit" => ""

            ],
            [
                "title" => "優惠券",
                "value" => $coupon,
                "unit" => "年",
                "unitColor" => "success",
                "subTitle" => "優惠券",
                "subValue" => 49,
                "subUnit" => ""

            ]
        ];
        return $this->success($data);
    }
}
